// import Vue from 'vue'
// import { Message } from 'element-ui'
import router from './router'

router.beforeEach((to, from, next) => {
  const token = localStorage.getItem('ACCESS_TOKEN')
  if (!token) {
    // Message.warning('登录已过期，请重新登录')
    if (to.path === '/login') {
      next()
    } else {
      next({ path: '/login' })
    }
  } else if (to.path === '/login') {
    next('/')
  } else {
    next()
  }
})
